<template>
  <div class="cw-echarts-fourone" :id="name"></div>
</template>


<script>
import echarts from "echarts";
export default {
  
  data() {
    return {
      name: "cw-fourone"
    };
  },
  created() {
    this.$nextTick(function() {
      // 需要修改 twotwo
      this.drow(this.name);
    });
  },
 
  methods: {
   drow(id) {
      this.charts = echarts.init(document.getElementById(id));
      this.charts.setOption({
        title: {
          text: "工资比例",
          left: "center",
          textStyle: {
            color: "rgb(255, 255, 255)",
            fontSize: 18
          }
        },
         color: ["#64a2dc", "#4b76cb", "#91c7ae", "#aaaaaa", "#f7c002"],
        tooltip: {
          trigger: "item",
          formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
          // orient: 'vertical',
          // top: 'middle',
          bottom: 10,
          left: "center",
          data:  ["清洁员", "警戒员", "饲养员", "部门经理", "销售经理"],
          textStyle: {
            color: "rgb(255, 255, 255)"
          }
        },
        series: [
          {
            type: "pie",
            radius: "65%",
            center: ["50%", "50%"],
            selectedMode: "single",
            data: [
              {
                value: 100,
                name: "清洁员"
              },
              {
                value: 100,
                name: "警戒员"
              },
              {
                value: 300,
                name: "饲养员"
              },
              {
                value: 155,
                name: "部门经理"
              },
              {
                value: 120,
                name: "销售经理"
              }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)"
              }
            }
          }
        ]
      });
    }
  }
}
</script>

<style lang="scss">
// 需要修改 .xz-echarts-xx
.cw-echarts-fourone {
  height: 360px;
  width: 100%;
}
</style>